F90=gfortran
FFLAGS= -ffree-line-length-0  -fno-range-check
LIB=limbes
LIB_dir=../lib
INC=../include

LIMBES_f_init_SOURCES =  LIMBES_f_init.f90 
LIMBES_f_init_OBJECTS = LIMBES_f_init.o
LIMBES_mesh_SOURCES = src/LIMBES_mesh_mod.f90 LIMBES_mesh.f90
LIMBES_mesh_OBJECTS = LIMBES_mesh_mod.o LIMBES_mesh.o

all: LIMBES_mesh.exe LIMBES_f_init.exe

LIMBES_mesh.exe: $(LIMBES_mesh_OBJECTS)
	@rm -f LIMBES_mesh.exe
	$(F90) $(FFLAGS) -o LIMBES_mesh.exe $(LIMBES_mesh_OBJECTS) 
	(rm -rf *.mod *.o)

$(LIMBES_mesh_OBJECTS): $(LIMBES_mesh_SOURCES)
	$(F90) $(FFLAGS) -c $(LIMBES_mesh_SOURCES) 

LIMBES_f_init.exe: $(LIMBES_f_init_OBJECTS)
	@rm -f LIMBES_f_init.exe
	$(F90) $(FFLAGS) -o LIMBES_f_init.exe $(LIMBES_f_init_OBJECTS) -L$(LIB_dir) -l$(LIB) 
	(rm -rf *.mod *.o)

$(LIMBES_f_init_OBJECTS): $(LIMBES_f_init_SOURCES)
	$(F90) $(FFLAGS) -I$(INC) -c $(LIMBES_f_init_SOURCES) 


clean :
	rm -rf LIMBES_f_init.exe  LIMBES_mesh.exe $(LIMBES_f_init_OBJECTS) $(LIMBES_mesh_OBJECTS) *.mod *.f90~
